package com.jp.knowledge.my.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.jp.knowledge.R;
import com.jp.knowledge.adapter.JPRecycleViewHolder;
import com.jp.knowledge.adapter.JpBaseRecyViewAdapter;
import com.jp.knowledge.model.CommTags;

import java.util.List;

/**
 * Created by jiayen on 16/11/30.
 *
 * 左边菜单
 */

public class LeftAdapter extends JpBaseRecyViewAdapter {
    public LeftAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    public int getLayoutId() {
        return R.layout.left_item_view;
    }

    @Override
    public void bindViewHold(JPRecycleViewHolder holder, int position) {
        TextView name = holder.getView(R.id.item);
        View line = holder.getView(R.id.line);
        CommTags commTags = (CommTags) getItem(position);
        name.setText(commTags.getName());

        if(commTags.isSelected()){
            line.setVisibility(View.VISIBLE);
            name.setTextColor(mContext.getResources().getColor(R.color.top_bg_color));
            holder.itemView.setBackgroundResource(R.color.white);

        }else{
            name.setTextColor(mContext.getResources().getColor(R.color.font_black));
            line.setVisibility(View.GONE);
            holder.itemView.setBackgroundResource(R.color.left_color);
        }
    }
}
